Skip to content

CFE-4708: Added support for a path-augment to specify files to ship beyond the extension-matching - #3204

Open
SimonThalvorsen wants to merge 1 commit into
cfengine:masterfrom
SimonThalvorsen:CFE-4708
Open

CFE-4708: Added support for a path-augment to specify files to ship beyond the extension-matching#3204
SimonThalvorsen wants to merge 1 commit into
cfengine:masterfrom
SimonThalvorsen:CFE-4708

Conversation

@SimonThalvorsen

Copy link
Copy Markdown
Contributor

Ticket: CFE-4708
Changelog: Added input_paths_extra to allow specified files to ship independent of what is specified in input_name_patterns[_extra]

@cf-bottom

Copy link
Copy Markdown

Thank you for submitting a pull request! Maybe @nickanderson can review this?

…eyond the extension-matching

Ticket: CFE-4708
Changelog: Added `input_paths_extra` to allow specified files to ship
independent of what is specified in `input_name_patterns[_extra]`

Signed-off-by: Simon Halvorsen <simon.halvorsen@northern.tech>

@nickanderson nickanderson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No ticket in the commit subject, that's for the PR.

I am not sure about this.

I understand that you are adding a file path to the files distributed in update.

  • This is a fully qualified file path? Can you give an example of what values a user would be expected to use here?
  • You say these files would be updated each time, regardless of validated_updates_ready, so these files could update but the rest of the policy could be skipped?

Comment thread cfe_internal/update/update_policy.cf
Comment thread cfe_internal/update/update_policy.cf
Comment thread controls/update_def.cf.in
@SimonThalvorsen

SimonThalvorsen commented Aug 26, 2026

Copy link
Copy Markdown
Contributor Author

No ticket in the commit subject, that's for the PR.

I am not sure about this.

I understand that you are adding a file path to the files distributed in update.

* This is a fully qualified file path? Can you give an example of what values a user would be expected to use here?

* You say these files would be updated each time, regardless of validated_updates_ready, so these files could update but the rest of the policy could be skipped?

I am not certain that the hashing in GeneratePolicyRelease() is what messes it up, but the issue
is that originally I just added a variable input_paths_extra to contain the extra filepaths that may exists outside of what is defined in input_name_patterns (since these gets copied from before). In the first iteration i just expandend the file_select u_input_files-body to use the path_name-parameter and then use it like this:

leaf_name => {
  @(update_def.input_name_patterns), @(update_def.input_name_patterns_extra)
};
path_name => { @(update_def.input_paths_extra) };
file_result => "leaf_name|path_name";

but that only worked for the initial copy, so if the project got rebuilt with the same files(but different content) only the .sh (and assumes .txt, .cf and other accepted extensions) would get marked as changed and the client got the new content, but keeping the old, unchanged version of the other files.

The usage is intended for files added by cfbs input-type-file, where the supplied files may not match what is set inside ìnput_name_patterns and adding the extension (or no extension at all) to input_name_patterns_extra may cause more files that what one would want to get shipped.

@nickanderson

Copy link
Copy Markdown
Member

No ticket in the commit subject, that's for the PR.
I am not sure about this.
I understand that you are adding a file path to the files distributed in update.

* This is a fully qualified file path? Can you give an example of what values a user would be expected to use here?

* You say these files would be updated each time, regardless of validated_updates_ready, so these files could update but the rest of the policy could be skipped?

I am not certain that the hashing in GeneratePolicyRelease() is what messes it up, but the issue is that originally I just added a variable input_paths_extra to contain the extra filepaths that may exists outside of what is defined in input_name_patterns (since these gets copied from before). In the first iteration i just expandend the file_select u_input_files-body to use the path_name-parameter and then use it like this:

leaf_name => {
  @(update_def.input_name_patterns), @(update_def.input_name_patterns_extra)
};
path_name => { @(update_def.input_paths_extra) };
file_result => "leaf_name|path_name";

but that only worked for the initial copy, so if the project got rebuilt with the same files(but different content) only the .sh (and assumes .txt, .cf and other accepted extensions) would get marked as changed and the client got the new content, but keeping the old, unchanged version of the other files.

The usage is intended for files added by cfbs input-type-file, where the supplied files may not match what is set inside ìnput_name_patterns and adding the extension (or no extension at all) to input_name_patterns_extra may cause more files that what one would want to get shipped.

I would remove git from the equation initially. Edit files in /var/cfengine/masterfiles on a hub and understand that basic flow first.
from memory ...
validated_updates_ready is defined when the client repaires it's copy of cf_promsies_validated. cf_promises_validated on the hubs /var/cfengine/masterfiles is updated when the hub sees that it's running and validates new policy in inputs. So, you change masterfiles, update.cf runs from inputs, promises.cf runs from inputs, which causes cf_promises_validated in /var/cfengine/masterfiles to be updated, then clients see that file changed, which lifts the gate for the client to scan all the rest of the files for change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants